package com.learn.lsp.bad;

public class Test {

    public static void calculation(Rectangle rectangle) {
        while (rectangle.getWidth() >= rectangle.getHeight()) {
            System.out.println("宽为: " + rectangle.getWidth() + " 高为: " + rectangle.getHeight());
            rectangle.setHeight(rectangle.getHeight() + 1);
        }
        System.out.println("结束宽为: " + rectangle.getWidth() + " 结束高为: " + rectangle.getHeight());
    }

    // 长方形
//    public static void main(String[] args) {
//        calculation(new Rectangle().setHeight(10).setWidth(20));
//    }

    // 正方形 -- 无限循环
    public static void main(String[] args) {
        calculation(new Square().setLength(20));
    }
}
